package com.jl.magic.montage;

import com.jl.magic.montage.compose.AbstractSynthesizer;
import com.jl.magic.montage.compose.SquareSynthesizer;
import com.jl.magic.montage.config.AbstractInlayConfig;
import com.jl.magic.montage.model.Inlay;
import com.jl.magic.montage.model.SubImage;
import com.jl.magic.montage.slicer.AbstractSlicer;
import com.jl.magic.montage.slicer.SquareSlicer;
import com.jl.magic.montage.tessera.AbstractInlayHandler;
import com.jl.magic.montage.tessera.SquareInlayHandler;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;

/**
 * @author jiangli
 * @create 2020/7/15 9:11 上午
 */
public class SquareFactory implements StrategyFactory {

    @Override
    public AbstractSlicer createSlicer(BufferedImage source, AbstractInlayConfig inlayConfig, int sliceCount) {
        return new SquareSlicer(source, inlayConfig, sliceCount);
    }

    @Override
    public AbstractInlayHandler createInlayHandler(List<File> images, AbstractInlayConfig inlayConfig, boolean compressed) {
        SquareInlayHandler handler = new SquareInlayHandler();
        handler.setFiles(images);
        handler.setInlayConfig(inlayConfig);
        handler.setCompressed(compressed);
        return handler;
    }

    @Override
    public AbstractSynthesizer createSynthesizer(List<SubImage> subImageList, List<Inlay> inlayList, AbstractInlayConfig inlayConfig) {
        SquareSynthesizer synthesizer = new SquareSynthesizer();
        synthesizer.setSubImageList(subImageList);
        synthesizer.setInlayList(inlayList);
        synthesizer.setInlayConfig(inlayConfig);
        return synthesizer;
    }

}
